Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize tree walk to avoid too depth function call stack. #326

Merged
merged 3 commits into from
Feb 21, 2019

Conversation

rubenvp8510
Copy link
Collaborator

Which problem is this PR solving?

Short description of the changes

  • After taking a look a the Issue and run the test code mentioned in the issue, it seems like the UI is freezing on the tree walk method when the tree is too depth. After did some tests I think that the "recursive" function calling could be the problem.

I did some tests and it seems to behave better with an iterative walk algorithm. This partially solves the problem, because the render of too many components is slow. We could probably need to impose a limit on the depth (But at least now is not freezing anymore)

@codecov
Copy link

codecov bot commented Feb 8, 2019

Codecov Report

Merging #326 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #326      +/-   ##
==========================================
+ Coverage    83.1%   83.14%   +0.04%     
==========================================
  Files         142      142              
  Lines        3172     3181       +9     
  Branches      654      654              
==========================================
+ Hits         2636     2645       +9     
  Misses        429      429              
  Partials      107      107
Impacted Files Coverage Δ
packages/jaeger-ui/src/utils/TreeNode.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2abe94e...7b6ff66. Read the comment docs.

@rubenvp8510 rubenvp8510 force-pushed the Issue-320 branch 2 times, most recently from 3d691f8 to 1f463dc Compare February 12, 2019 19:32
@rubenvp8510 rubenvp8510 reopened this Feb 13, 2019
Copy link
Member

@tiffon tiffon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An iterative approach is definitely be more efficient than the recursive approach (especially in JS), thanks!

Looks like there might be an issue with the depth. Can you take a look at the comments? Would you mind adding a test-case that checks for this?

packages/jaeger-ui/src/utils/TreeNode.js Outdated Show resolved Hide resolved
packages/jaeger-ui/src/utils/TreeNode.js Outdated Show resolved Hide resolved
packages/jaeger-ui/src/utils/TreeNode.js Outdated Show resolved Hide resolved
packages/jaeger-ui/src/utils/TreeNode.js Outdated Show resolved Hide resolved
Signed-off-by: ruben.vargas <[email protected]>
@rubenvp8510
Copy link
Collaborator Author

Ready for another review :)

@ghost ghost assigned tiffon Feb 21, 2019
@ghost ghost added the review label Feb 21, 2019
@tiffon
Copy link
Member

tiffon commented Feb 21, 2019

Awesome work! Thanks so much for making these changes! 🎉

@tiffon tiffon merged commit dd4f809 into jaegertracing:master Feb 21, 2019
@ghost ghost removed the review label Feb 21, 2019
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 5, 2021
…cing#326)

* Optimize tree walk

Signed-off-by: ruben.vargas <[email protected]>

* Add test to treeNode walk function for check depth calculation

Signed-off-by: ruben.vargas <[email protected]>

Signed-off-by: vvvprabhakar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants